export default (context, ext = '.js') => {
  const map = {};
  context.keys().forEach((key) => {
    let mapKey = key.replace(/.*\//, '');
    if (ext) {
      mapKey = mapKey.replace(new RegExp(`${ext}$`), '');
    }
    map[mapKey] = context(key);
  });
  return map;
};
